// Copyright (C) 2025 Kumo inc.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

#include <type_traits>

#include <rothar/pegtl.hpp>
#include <rothar/pegtl/contrib/alphabet.hpp>

namespace test
{
   // We only need to test that this compiles...

   struct foo
      : ROTHAR_PEGTL_STRING( "foo" )
   {};

   struct foobar
      : rothar::sor< ROTHAR_PEGTL_STRING( "foo" ), ROTHAR_PEGTL_STRING( "bar" ) >
   {};

   static_assert( std::is_same_v< ROTHAR_PEGTL_STRING( "Hello" ), rothar::string< 'H', 'e', 'l', 'l', 'o' > > );
   static_assert( !std::is_same_v< ROTHAR_PEGTL_ISTRING( "Hello" ), rothar::string< 'H', 'e', 'l', 'l', 'o' > > );
   static_assert( std::is_same_v< ROTHAR_PEGTL_ISTRING( "Hello" ), rothar::istring< 'H', 'e', 'l', 'l', 'o' > > );

   static_assert( std::is_same_v< ROTHAR_PEGTL_KEYWORD( "private" ), rothar::keyword< 'p', 'r', 'i', 'v', 'a', 't', 'e' > > );

   // Strings may even contain embedded nulls

   static_assert( std::is_same_v< ROTHAR_PEGTL_STRING( "Hello, w\0rld!" ), rothar::string< 'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 0, 'r', 'l', 'd', '!' > > );

   // The strings currently have a maximum length of 512 characters.

   using namespace rothar::alphabet;
   static_assert( std::is_same_v< ROTHAR_PEGTL_STRING( "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" ),
                                  rothar::string< a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z > > );

}  // namespace test

int main()
{
   return 0;
}
